package com.kaikai.edu.config;

import com.kaikai.edu.filter.AuthInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * @Author yujiankai
 * @Description 拦截器配置
 * @date 2021/12/1 15:23
 */
@Configuration
public class ConfigInterceptor extends WebMvcConfigurerAdapter {

    @Bean
    public HandlerInterceptor getAuthInterceptor(){
        return new AuthInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(getAuthInterceptor()).addPathPatterns("/**");
    }
}
